package cn.kgc;

import cn.kgc.dao.desktop.ScheduleDao;
import cn.kgc.service.desktop.ScheduleDaoService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

@SpringBootTest
public class LUORUITEST {

    @Autowired
    ScheduleDaoService scheduleDaoService;

    @Autowired
    ScheduleDao scheduleDao;

//    @Autowired
//    TypeDaoService typeDaoService;

//    @Autowired
//    ContactDaoService contactDaoService;

    @Test
    void test() {
        scheduleDaoService.queryAllAffairs("", null, null, null, null, null, 1, 5,5).forEach(System.out::println);
    }
//
//    @Test
//    void queryAllTypeInfo() {
//        System.out.println(typeDaoService.queryAllTypeInfo());
//    }

//    @Test
//    void queryAllContactInfo() {
//        System.out.println(contactDaoService.queryAllContactInfo());
//    }
//
//    @Test
//    void queryAllLocation() {
//        System.out.println(locationDaoService.queryAllLocation());
//    }

    @Test
    void addData() {
//        Schedule schedule = new Schedule("meeting", Date.valueOf("2023-09-09"), Time.valueOf("12:00:00"), 1, "Metting", 1, 1,1);
//        System.out.println(scheduleDaoService.addData(schedule));
    }

    @Test
    void queryAllDateFromAffairs() {
        System.out.println(scheduleDaoService.queryAllDateFromAffairs(1));
    }

    @Test
    void deleteDataTest() {
        System.out.println(scheduleDaoService.deleteData(2));
    }

    @Test
    void queryAffairsCount() {
        System.out.println(scheduleDaoService.queryAffairsCount("", null, null, null, null, null, 5));
//        System.out.println(scheduleDaoService.queryAffairsCount("",Date.valueOf("2021-01-01"),Date.valueOf("2023-01-01"),1,null,null));
    }

    @Test
    void queryUpdatedTarget() {
        System.out.println(scheduleDaoService.queryUpdatedTarget(3));
    }

    @Test
    void updateData() {
        scheduleDaoService.updateData(1,null);
    }

    @Test
    void QueryAllData(){
        scheduleDaoService.QueryAllData("");
    }

    /*Dict*/
    @Test
    void queryAllTypeInfo(){
        System.out.println(scheduleDaoService.queryAllTypeInfo());
    }

    @Test
    void queryAllLocationInfo(){
        System.out.println(scheduleDaoService.queryAllLocationInfo());
    }

    @Test
    void queryAllContact(){
        scheduleDaoService.queryAllContact().forEach(System.out::println);
    }

    @Test
    void queryAllDict(){
        scheduleDaoService.queryAllDict().forEach(System.out::println);
    }

    @Test
    void queryDuration(){
        System.out.println(scheduleDaoService.queryDuration());
    }

    @Test
    void queryLeaveRequest(){
        scheduleDaoService.queryLeaveRequest(1).forEach(System.out::println);
    }

    @Test
    void queryLeaveRequestCount(){
        System.out.println(scheduleDaoService.queryLeaveRequestCount(1));
    }

    @Test void queryLeaveApplyCount(){
        System.out.println(scheduleDaoService.queryLeaveApplyCount(1));
    }
}
